$(function() {
	$('#vue_vm_list').hide();
	var elderBeHospitalId = $.url().param('elderBeHospitalId');
	if(elderBeHospitalId) {
		find_elder_by_elderBeHospitalId(elderBeHospitalId);
	}
});

function find_elder_by_elderBeHospitalId(elderBeHospitalId) {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list').hide();

	find_basic_by_json(path+'/elderBeHospital/findDetail', {id: elderBeHospitalId}, function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		for(var i=0; i<response.data.length; i++) {
			if(view && view.data) {
				view.data.elderId = response.data[i].elderId;
				view.data.elderName = response.data[i].elderName;
				view.data.beNumber = response.data[i].beNumber;
				view.data.staffName = getLoginedUser()? getLoginedUser().staffName: '';
				view.data.payDate = getStandardDayByDate(response.data[i].createTime);
			}
		}
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			},
			methods: {
				getNowDiff: function(sDate1) {
					var nowDate = getNowFormatDate().substr(0,10);
					return DateDiff(nowDate, sDate1);
				},
				getSubsidizationValue:function(subsidization, subsidizationValue) {
					return getSubsidizationValue(subsidization, subsidizationValue);
				},
				getSubsidizationUnit:function(subsidization) {
					return getSubsidizationUnit(subsidization);
				},
				getSubsidizationText:function(subsidization, subsidizationValue) {
					return getSubsidizationText(subsidization, subsidizationValue);
				},
				getConsDeductionText:function(consumptionWay, consDeductionWay) {
					return getConsDeductionText(consumptionWay, consDeductionWay);
				},
				//总共可扣月数
				getTotalMonths:function(todo) {
					return getTotalMonths(todo);
				},
				//剩余可扣月数
				getRemainMonths:function(todo) {
					return getRemainMonths(todo);
				},
				//已扣月数
				getAlreadyUsedMonths:function(todo) {
					return getAlreadyUsedMonths(todo);
				},
				//总共可扣天数
				getTotalNumber:function(todo) {
					return getTotalNumber(todo);
				},
				//剩余可扣天数
				getRemainNumber:function(todo) {
					return getRemainNumber(todo);
				},
				//已扣天数
				getAlreadyUsedNumber:function(todo) {
					return getAlreadyUsedNumber(todo);
				},
				getChepingUrl:function(elderId, elderName, elderCardId) {
					return getChepingUrl(elderId, elderName, elderCardId);
				}
			}
		});
		
		$('#vue_vm_list').show();
	});
}